package com.nahan.secondapplication.Mesh;

import android.graphics.Color;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.nahan.secondapplication.R;

import java.util.ArrayList;

/**
 * @describe: 描述：网状图
 * @time: 2020-7-23 11:08:31
 */
public class MeshActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mesh);


        ReticularView myView = findViewById(R.id.view);
        ArrayList<ReticularView.Values> data = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            ReticularView.Values values = new ReticularView.Values();
            values.setName("图"+i);
            if(i==0){
                values.setValue(13);
            }else {
                values.setValue(i+5);
            }
            data.add(values);
        }
        myView.drawView()
                .setData(data)
                .setShapeNumber(data.size())
                .setCycleNumber(4)
                .setDrawRegionCircle(Color.BLACK)

                .setPolygonBgColors(false,new int[]{Color.RED})
                .setRegionColor(Color.YELLOW)
//                .setRegionColor(Color.RED,false,130)
//                .setRegionColor(Color.YELLOW)
                .setLinColors(new int[]{Color.RED})
//                .setLinColors(new int[]{Color.RED,Color.BLUE,Color.GREEN,Color.MAGENTA})
                .setTextColor(Color.BLACK)
                .setLinWidth(2)
                .setTextSize(16)
                .setMaxValue(16)
                .build();
    }
}
